package com.uoss.applications.main;

import java.util.Date;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.uoss.applications.framework.dao.model.QueryModel;
import org.uoss.applications.framework.dao.model.ResultSetModel;
import org.uoss.applications.framework.exception.BIZException;

import com.uoss.applications.modules.foundation.biz.IAgencyBIZ;
import com.uoss.applications.modules.foundation.entities.TcAgency;

public class MainCommand {
	
	public static void main(String[] args){
		System.out.println("Applications Main starting...... ");
		//System.setProperty("properties.file.name", "application.properties");

		String[] configs = { "META-INF/Biz-Application-Context.xml"};
		ApplicationContext context = new ClassPathXmlApplicationContext(configs);

		try {
			TcAgency agency = new TcAgency();
			agency.setAgencyCode("GUANGZHOU");
			agency.setAgencyName("广州");
			agency.setComments("");
			agency.setRecDate(new Date());
			agency.setStatus("A");
			IAgencyBIZ agencyBiz = (IAgencyBIZ)context.getBean("agencyBIZImpl");
			agencyBiz.addAgency(agency);
			QueryModel query = new QueryModel();
			query.setPageIndex(1);
			query.setPageSize(10);
			ResultSetModel<TcAgency> result = agencyBiz.getAgencyResultSetByPaging(query);
			for(TcAgency agency1 : result.getItems()){
				System.out.println(agency1.getAgencyName());
			}
		} 
		catch (BIZException e) {
			e.printStackTrace();
		}
		System.out.println("Schedule Main started... ");
	}

}
